package com.web.dao.impl;

import com.entity.Setmeal;
import com.entity.SetmealExample;
import com.mapper.SetmealMapper;
import com.page.PageInfo;
import com.web.dao.SetmealDao;
import com.web.dao.SetmealForCustomerDao;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Repository("setmealDao")
public class SetmealDaoImpl implements SetmealDao , SetmealForCustomerDao {
    @Resource
    SetmealMapper setmealMapper;



    public  Setmeal selectByPrimaryKey(String cid) throws Exception {
        return setmealMapper.selectByPrimaryKey(cid);
    }

    /**
     * 根据套餐获得食品详情
     * @param smid
     * @return
     * @throws Exception
     */
    public Setmeal selectByPrimaryKeyWithSetMealFoods(String smid) throws Exception{
        return setmealMapper.selectByPrimaryKeyWithSetMealFoods(smid);
    }







    public int add(Setmeal setmeal) throws Exception {
        return setmealMapper.insertSelective(setmeal);
    }

    public int update(Setmeal setmeal) throws Exception {
        return setmealMapper.updateByPrimaryKeySelective(setmeal);
    }
}
